/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __BUTTON_H__
#define __BUTTON_H__

/* Includes ------------------------------------------------------------------*/
#include "stm8s.h"

/* Exported types ------------------------------------------------------------*/
#define BUTTON1_ACTIVE  0x01
#define BUTTON2_ACTIVE  0x02
#define BUTTON3_ACTIVE  0x04
#define BUTTON4_ACTIVE  0x08
#define BUTTON5_ACTIVE  0x10
#define BUTTON6_ACTIVE  0x20

#define TOTAL_BUTTON    6

typedef enum
{
    NORMAL_BUTTON,
    ENTER_LEARN_BUTTON,
    PREPARE_LEARN_BUTTON_FOR_RELAY,
    LEARN_BUTTON_FOR_RELAY,
    QUIT_LEARN_BUTTON
} eButtonMode;

/* Exported constants --------------------------------------------------------*/
#define BUTTON1_PORT    (GPIOB)
#define BUTTON1_PINS    (GPIO_PIN_4)
#define BUTTON2_PORT    (GPIOB)
#define BUTTON2_PINS    (GPIO_PIN_5)
#define BUTTON3_PORT    (GPIOC)
#define BUTTON3_PINS    (GPIO_PIN_6)
#define BUTTON4_PORT    (GPIOD)
#define BUTTON4_PINS    (GPIO_PIN_2)
#define BUTTON5_PORT    (GPIOC)
#define BUTTON5_PINS    (GPIO_PIN_7)
#define BUTTON6_PORT    (GPIOD)
#define BUTTON6_PINS    (GPIO_PIN_3)

/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */

void Button_Init(void);
eButtonMode Button_GetMode();
void Button_RunOne(void);

#endif /* __BUTTON_H__ */

